package com.john.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@SpringBootApplication
@PropertySource("classpath:/jdbc.properties")
@ConfigurationProperties(prefix = "jdbc")
public class DemoApplication {

//    @Value("${url}")
    private String url;

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }


    @PostConstruct
    public void intit() {
        System.out.println("url: " + url);
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
